package com.springboot.java0317springboot.iocdemo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Component;

/**
 * @author lenovo
 * @Description
 * @Date2025-3-17 22:26
 */
@Component
public class Home {

    private final Air air;
    private  final TV tv;

    @Autowired
    public Home(Air air,TV tv) {
        this.air = air;
        this.tv = tv;
    }

    // 开门方法
    public void openDoor() {
        System.out.println("房子开门了...");
        air.cool();
        tv.play();
    }

    public Air getAir() {
        return air;
    }

    public TV getTv() {
        return tv;
    }
}
